package mo.leetcode_top;

public class L55 {

    public boolean canJump(int[] nums) {
        int k = 0;
        int length = nums.length;
        for (int i = 0; i < length; i++) {
            if (k < i) {
                return false;
            }
            k = Math.max(k, i+nums[i]);
            if (k >= length - 1) {
                return true;
            }
        }
        return true;
    }

}
